<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>
<% 
String userid = "";
int auth=99;
String userr="";
userr = (session.getAttribute("userr")==null) ? "Null" : (String)session.getAttribute("userr"); 
	String Location = application.getRealPath(request.getServletPath());
	String dirpath = Location.substring(0,Location.lastIndexOf("\\"));
	String DownloadsPath = dirpath+"/Downloads/"+"/Resumes/";

if(userr.equals("Null"))
{
	session.invalidate();
	%>
	<script language=javascript>
		location.replace('sessiontimeout.html');
	</script>
	<% 
}
else{
	Integer IAuth =(Integer)session.getAttribute("auth");
	if(IAuth!=null)
	{auth= IAuth.intValue();}
	System.out.println("===Authentication=="+auth);

%>
<HEAD>

           
	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>

	
	<LINK href="styles.css" type="text/css" rel="stylesheet">
<script LANGUAGE="Javascript" SRC="">

function fnUpload()
	{
		var userid = document.forms(0).userid.value;
		fnEmpPopUp('UploadResume1.jsp?userid='+userid,80,400);
	}
function fnUpdateDB()
	{
		var userid = document.forms(0).userid.value;
		var ResumePath=document.forms(0).ResumePath.value;
		fnEmpPopUp('UpdateResume1.jsp?ResumePath='+ResumePath+'&userid='+userid,5,5);
	}
</script>
	<script LANGUAGE="Javascript" SRC="">

	<!--
		function fnUpdateDetails(userid,U)
			{
				var URL = U+"?userid="+userid;
				fnEmpPopUp(URL,600,600);
			}
	//-->
	</script>
</HEAD>
<BODY class=Grad>
<%
if(auth==1){		
	// Link for Job seekers to view the appiied jobs
%>
<P align="right"><a href="ViewAppliedJobs.jsp?userid=<%=userr%>" target="ResultFrame">
<img border="0" name="ViewAppliedJobs" src="Images/MyApp1.jpg"  onmouseover="document['ViewAppliedJobs'].src='Images/MyApp1.jpg'" onmouseout="document['ViewAppliedJobs'].src='Images/MyApp2.jpg'" ></a></td>

<h2 align=center>Details of <%=userr%></h2>
<FORM Name="UpdateDetails">
<%

	Connection con=null;
	ResultSet rs=null,rs1=null,rs2=null,rs3=null,rs4=null;
	Statement stmt=null,stmt1=null,stmt2=null,stmt3=null,stmt4=null;
	try{
			
	/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	con = DriverManager.getConnection("jdbc:odbc:JobPortal","root",""); */


			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Select * from educationaldetails where userid='"+userr+"'";
			System.out.println(Query);
			rs = stmt.executeQuery(Query);
			stmt1 =  con.createStatement();
			String Query1 = "Select * from contactinformation where userid='"+userr+"'";
			rs1 = stmt1.executeQuery(Query1);
			System.out.println(Query1);
			stmt2 =  con.createStatement();
			String Query2 = "Select * from professionalinformation where userid='"+userr+"'";
			rs2 = stmt2.executeQuery(Query2);
			System.out.println(Query2);
            stmt3 =  con.createStatement();
			String Query3 = "Select * from login where userid='"+userr+"'";
			rs3 = stmt3.executeQuery(Query3);
			System.out.println(Query3);
			stmt4 =  con.createStatement();
			String Query4 = "Select * from personalinformation where userid='"+userr+"'";
			rs4 = stmt4.executeQuery(Query4);
			System.out.println(Query4);

			}
			catch(Exception e){

			%><%=e%><%
		}
		if(rs3!=null)
{
			%>
	<!--Displaying the table header-->

	<br>
<!--	<DIV STYLE="overflow:scroll;width:650px; height:400px;">-->

	
<%
int DisRow3=0;
			while(rs3.next())
			{
				userid	=rs3.getString(1);
				String	password=rs3.getString(2);
						
				DisRow3++;
					%>

				<table align=center border=0  width="60%">
				<TR class="row_title">
				<Td align=center> Login Details<BR></Td>
				
				</tr>
				 <tr><td align=Left style="background-color:#82C0FF" width="50%">
					<b>User Id</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=userid%></font><INPUT TYPE="hidden" NAME="userid" value="<%=userr%>"></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Password</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=password%></font></td></tr>
				</tr>
				</table>	

	

	<%
		}	
if(rs3!=null)
{
			%>
	<!--Displaying the table header-->

	<br>
<!--	<DIV STYLE="overflow:scroll;width:650px; height:400px;">-->

	
<%
int DisRow4=0;
			while(rs4.next())
			{
						String	DateOfBirth			=rs4.getString(3);
						String	Gender			=rs4.getString(4);
						
				DisRow4++;
					%>

				<table align=center border=0  width="60%">
				<TR class="row_title">
				<Td align=center width="50%"> Personal Information<BR></Td>
				
				</TR>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Date Of Birth</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black" width="50%"><%=DateOfBirth%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Gender</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=Gender%></font></td></tr>
							
					</tr>
					</table>	

	

	<%
		}	
	
if(rs1!=null)
{
			%>
	<!--Displaying the table header-->

	<br>
<!--	<DIV STYLE="overflow:scroll;width:650px; height:400px;">-->

	
<%
int DisRow1=0;
			while(rs1.next())
			{
						String	FirstName			=rs1.getString(3);
						String	LastName			=rs1.getString(4);
						String	Email				=rs1.getString(5);
						String	ContactNumber		=rs1.getString(6);
						String  CurrentLocation		=rs1.getString(7);
						String  Address				=rs1.getString(8);
				DisRow1++;
					%>

				<table align=center border=0  width="60%">
				<TR class="row_title">
				<Td align=center> Contact Information<BR></Td><td align=center style="background-color:#E1E1E1"><font  color="black"><A onclick='fnEmpPopUp("UpdateContact0.jsp?userid=<%=userid%>",600,600)'>Update</A></font></td>
				</TR>
				 <tr><td align=Left style="background-color:#82C0FF" width="50%"><b>First Name</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=FirstName%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Last Name</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=LastName%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Email</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=Email%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Contact Number</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=ContactNumber%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Current Location</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=CurrentLocation%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Address</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=Address%></font></td></tr>
				 
			
					</tr>
					</table>	

	

	<%
		}
if(rs!=null)
{
			%>
	<!--Displaying the table header-->

	<br>
<!--	<DIV STYLE="overflow:scroll;width:650px; height:400px;">-->

	
<%
int DisRow=0;
			while(rs.next())
			{
				 userid=rs.getString(2);
				 String	BasicQualification	=rs.getString(3);
						String	PercentageBQ	=rs.getString(4);
						String  YearOfPassBQ    =rs.getString(5);
						String  UniversityBQ   =rs.getString(6);
						String	PostGraduation	=rs.getString(7);
						String	Percentage		=rs.getString(8);
						String  YearOfPass    =rs.getString(9);
						String  University  =rs.getString(10);

				DisRow++;
					%>

				<table align=center border=0  width="60%">
				<TR class="row_title">
				<Td align=center> Educational Details<BR></Td><td align=center style="background-color:#E1E1E1"><font  color="black"><A onclick='fnEmpPopUp("UpdateEducation0.jsp?userid=<%=userid%>",600,600)'>Update</A></font></td>
				</TR>
				 <tr><td align=Left style="background-color:#82C0FF" width="50%"><b>Basic Qualification</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=BasicQualification%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Percentage</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=PercentageBQ%></font></td></tr>
				<tr><td align=Left style="background-color:#82C0FF" ><b>Year Of Pass</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=YearOfPassBQ%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>University</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=UniversityBQ%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Post Graduation</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=PostGraduation%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Percentage</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=Percentage%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Year Of Pass</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=YearOfPass%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>University</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=University%></font></td></tr>
				
			
					</tr>
					</table>	

	<%
	}
if(rs2!=null)
{
			%>
	<!--Displaying the table header-->

	<br>
<!--	<DIV STYLE="overflow:scroll;width:650px; height:400px;">-->

	
<%
int DisRow2=0;
			while(rs2.next())
			{
						String	TotalExperience	=rs2.getString(3);
						float	AnnualSalary	=rs2.getFloat(4);
						String  FunctionalArea    =rs2.getString(5);
						String  CompanyName   =rs2.getString(6);
						String	KeySkills	=rs2.getString(7);
						String	ResumeTitle		=rs2.getString(8);
						String	ResumePath		=rs2.getString(9);
						String  TextResume    =rs2.getString(10);

				DisRow++;
					%>

				<table align=center border=0  width="60%">
				<TR class="row_title">
				<Td align=center> ProfessionalInformation<BR></Td><td align=center style="background-color:#E1E1E1"><font  color="black"><A onclick='fnEmpPopUp("UpdateProfessional0.jsp?userid=<%=userid%>",600,600)'>Update</A></font></td>
				</TR>
				 <tr><td align=Left style="background-color:#82C0FF"  width="50%"><b>Total Experience</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=TotalExperience%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Annual Salary</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=AnnualSalary%></font></td></tr>
				<tr><td align=Left style="background-color:#82C0FF" ><b>Functional Area</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=FunctionalArea%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Company Name</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=CompanyName%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF" ><b>Key Skills</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=KeySkills%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Resume Title</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=ResumeTitle%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Text Resume</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><%=TextResume%></font></td></tr>
				 <tr><td align=Left style="background-color:#82C0FF"><b>Resume</b></td>
				 <td align=Left style="background-color:#E1E1E1"><font  color="black"><A HREF="FileDownloads.jsp?fileName=<%=DownloadsPath+"//"+ResumePath%>" ><U><B><%=ResumePath%></font></B></U></A></td></tr>

		</TABLE>
		<BR>
		<TABLE align=center width="60%">
		<TR class="row_title"><TH align="left">Update Resume</TH>
	 		<TD class="row_even">&nbsp;&nbsp;<div id="infodiv" style="color:red;"></div><Input type="text" name='ResumePath' class= "TextField"><INPUT id="FUBtn" name="FUBtn" class= "UploadButton" TYPE="Button" value='Attach Resume' onclick="fnUpload()" class="UploadButton"><INPUT TYPE="Button" value='Update' class="UploadButton" onclick="if(document.forms(0).ResumePath.value!=''){this.disabled=true;fnUpdateDB();}else{alert('Please attach resume to proceed');}">
			</TD>
		</TR>
        		

	<%
	}

	if(DisRow1==0)
{
	/*To write to the server if the resultset is null*/
	%>
		<CENTER>
			<tr><th colspan=6>No Records found</th></tr>
		</CENTER>
	<%}
}
}
}
}
	}
%>
		

</table>

</FORM>
</BODY>
</HTML>
<%


}else{
	// Link for employees to view the applications
%>	<P align="right"><a href="ViewApplications.jsp?userid=<%=userr%>" target="ResultFrame">
	<img border="0" name="ViewAppliedJobs" src="Images/MyApp1.jpg"  onmouseover="document['ViewAppliedJobs'].src='Images/MyApp1.jpg'" onmouseout="document['ViewAppliedJobs'].src='Images/MyApp2.jpg'" ></a></td>

<h2 align=center>Employer Details</h2>

<%

	Connection con=null;
	ResultSet rsE=null;
	Statement stmt=null;
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:jobportal","root",""); */

			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
			String Query = "Select * from employregistration where userid='"+userr+"'";
			rsE = stmt.executeQuery(Query);
			%>
						<table align="center" width="60%">
							<tr class=row_title>
								<th align=center colspan=2>Employer details</th>
							</tr>
					<%
			int rCount=0;
			while(rsE.next())
			{
					%>
					<tr class= "row_even">
							<th align="left">User Id</th><td><%=rsE.getString(1)%></td>
					<tr class= "row_odd">
							<th align="left">Employee Name</th><td><%=rsE.getString(3)%></td>
					<tr class= "row_even">
							<th align="left">Company Name</th><td><%=rsE.getString(5)%></td>
					<tr class= "row_odd">
							<th align="left">Contact Number</th><td><%=rsE.getString(6)%></td>
					<tr class= "row_even">
							<th align="left">Email ID</th><td><%=rsE.getString(7)%></td>
					<tr class= "row_odd">
							<th align="left">Date Of Registration</th><td><%=rsE.getString(8)%></td>
					<tr class= "row_even">
							<th align="left">Charges</th><td><%=rsE.getString(9)%></td>
					</tr>
					<%
				rCount++;
			}
			if( rCount == 0)	{%><h3 align=center>Sorry No records Found</h3><% }
			rsE.close();
			stmt.close();
			con.close();
		}catch(Exception e){
			stmt.close();
			con.close();
			%><%=e%><%
		}

}

}
%>
